/* Copyright (C) 2011 clueless <clueless.mmopeon@gmail.com>
 *
 * This file is part of MMO Peon.
 *
 * MMO Peon is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MMO Peon is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMO Peon.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __MMOPEON_MOVEMENT_H
#define __MMOPEON_MOVEMENT_H

#include "../commontypes.h"
#include "statemachine.h"
#include "waypoints.h"

class PlayerMovement
{
    public:
        enum Flags  {Left = 0x20, Right = 0x10, NoTurn = 0xCF,
                     Forward = 0x01, Backward = 0x02, NoRun = 0xBC,
                     LStrafe = 0x08, RStrafe = 0x04, NoStrafe = 0xF3,
                     Nothing = 0x00};

        PlayerMovement(MemBase *baseObject);
        void Move(const RomCoords& coords);
        void Move(const RomCoords *coords);
        void Turn(const RomCoords& coords);
        void Turn(const RomCoords *coords);
        void Stop();
        void Update();
        bool IsMoving() const;
        bool IsTurning() const;
        bool IsBusy() const;
        void SetFlags(PlayerMovement::Flags action);

    private:
        float       AngleDiff();

        bool        isTurning;
        bool        isMoving;
        RomCoords   target;
        MemBase     *baseObject;
};

#endif
